package ru.jexp.rcp.supply.viewer;

import org.eclipse.jface.viewers.DoubleClickEvent;
import org.eclipse.jface.viewers.IDoubleClickListener;

import ru.jexp.rcp.supply.actions.IOpenCommand;

public class JExpDoubleClickListener implements IDoubleClickListener {

	private final IOpenCommand openCommand;

	public JExpDoubleClickListener(IOpenCommand openCommand) {
		this.openCommand = openCommand;
	}

	@Override
	public void doubleClick(DoubleClickEvent event) {
		if (openCommand.canOpen()) {
			openCommand.open();
		}
	}
}
